﻿//Morgan Hansen
//
//

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;


namespace Controller
{
    class Client
    {

        static System.Net.Sockets.TcpClient client;
        public Client()
        {

        }
        public static void Connect()
        {
            Int32 port = 23;
            IPAddress localAddr = IPAddress.Parse("127.0.0.1");
            client = new System.Net.Sockets.TcpClient();
            client.Connect(localAddr, port);
            NetworkStream clientStream = client.GetStream();
            ASCIIEncoding encoder = new ASCIIEncoding();
            byte[] buffer;
            byte[] blackboxRe = new byte[7];
            while (true)
            {
               // x = Console.ReadLine();
                Thread.Sleep(1000);
                buffer = encoder.GetBytes("f"); //polling
                clientStream.Write(buffer, 0, buffer.Length);
                clientStream.Flush();
                clientStream.Read(blackboxRe, 0, 7);
                Console.WriteLine(blackboxRe[0] + " " + blackboxRe[1] + " " + blackboxRe[2] + " " + blackboxRe[3] + " " + blackboxRe[4] + " " + blackboxRe[5] + " " + blackboxRe[6]);
            }
        }//main
    }
}
